<template>
  <el-dialog
    title="详情"
    :close-on-click-modal="false"
    append-to-body
    :visible.sync="visible"
    class="jsbos-dialog jsbos-dialog_center"
    lock-scroll
    width="70%"
  >
    <el-row :gutter="15" class="">
      <el-form
        ref="elForm"
        :model="dataForm"
        size="small"
        label-width="100px"
        label-position="right"
      >
        <template v-if="!loading">
          <el-col :span="24">
            <el-form-item label="接收人" prop="toUserIds">
              <p>{{ dataForm.toUserIds }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="接收部门" prop="toDeptIds">
              <p>{{ dataForm.toDeptIds }}</p>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :md="12" :lg="8" :xl="6">
            <el-form-item label="业务系统" prop="taskCode">
              <p>{{ dataForm.taskCode }}</p>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :md="12" :lg="8" :xl="6">
            <el-form-item label="发送配置" prop="sendCode">
              <p>{{ dataForm.sendCode }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="关键词" prop="businessKey">
              <p>{{ dataForm.businessKey }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="自定义参数" prop="customKey">
              <p>{{ dataForm.customKey }}</p>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :md="12" :lg="8" :xl="6">
            <el-form-item label="状态" prop="enabledMark">
              <el-tag
                :type="dataForm.enabledMark == 2 ? 'success' : 'warning'"
                disable-transitions
              >
                <p>
                  {{ dataForm.enabledMark | dynamicText(enabledMarkOptions) }}
                </p>
              </el-tag>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="描述" prop="remark">
              <p>{{ dataForm.description }}</p>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :md="12" :lg="8" :xl="6">
            <el-form-item label="创建人" prop="creatorUser">
              <p>{{ dataForm.creatorUserId }}</p>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :md="12" :lg="8" :xl="6">
            <el-form-item label="创建时间" prop="creatorTimeFormat">
              <p>{{ dataForm.creatorTime }}</p>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :md="12" :lg="8" :xl="6">
            <el-form-item label="修改人" prop="lastModifyUser">
              <p>{{ dataForm.lastModifyUserId }}</p>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :md="12" :lg="8" :xl="6">
            <el-form-item label="修改时间" prop="lastModifyTimeFormat">
              <p>{{ dataForm.lastModifyTime }}</p>
            </el-form-item>
          </el-col>
        </template>
      </el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false"> 取 消</el-button>
    </span>
  </el-dialog>
</template>
<script>
import { getDetail } from "@/views/message/api/mcTaskMsg";
import PrintBrowse from "@/components/PrintBrowse";
export default {
  components: { PrintBrowse },
  props: [],
  data() {
    return {
      visible: false,
      loading: false,
      dataForm: {
        id: "",
        taskCode: "",
        sendCode: "",
        businessKey: "",
        customKey: "",
        toUserIds: "",
        toDeptIds: [],
        description: "",
        enabledMark: "1",
        creatorUserId: "",
        creatorTime: "",
        lastModifyUserId: "",
        lastModifyTime: "",
      },
      enabledMarkOptions: [
        { fullName: "待发送", id: "1" },
        { fullName: "已发送", id: "2" },
      ],
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    dataInfo(dataAll) {
      let _dataAll = dataAll;
      this.dataForm = _dataAll;
    },

    init(id) {
      this.dataForm.id = id || 0;
      this.visible = true;
      this.$nextTick(() => {
        if (this.dataForm.id) {
          this.loading = true;
          getDetail(this.dataForm.id).then((res) => {
            this.dataInfo(res.data);
            this.loading = false;
          });
        }
      });
    },
  },
};
</script>
